#include <iostream>
#include <string.h>
#include <string>
using namespace std;

string GetDomain(const string& str)
{
  size_t pos = str.find("://");

  if (pos != string::npos)
  {
    size_t start = pos + 3;
    size_t end = str.find('/', start);
    if (end != string::npos)
    {
      return str.substr(start, end - start);
    }
    else 
    {
      return string();
    }
  }
  else 
  {
    return string();
  }
}
string GetProtocol(const string& str)
{
  size_t pos = str.find("://");
  if ( pos != string::npos )
  {
    return str.substr(0,pos);
  }
  else 
  {
    return string();
  }

}
int main()
{
  /*string str1 = "hello world";

  str1.resize(20);
  str1 += "!!!";

  cout << strlen(str1.c_str()) << endl;

  cout << "str1=" <<  str1 << endl;
  cout << "str1.c_str1="<< str1.c_str()<< endl;*/ 

  /*string filename = "mytest.cpp";
  size_t pos = filename.find('.');
  if (pos != string::npos)
  {
    string  suff(filename, pos, filename.size() - pos);
    cout << suff << endl;
  }*/

  string ur1 = "https://editor.csdn.net/md?articleId=125834959";
  cout << GetDomain(ur1) << endl;
  cout << GetProtocol(ur1) << endl;


   


  return 0;
}
